package com.tshopping.controller;

import com.tshopping.service.UserService;
import com.tshopping.util.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @name: AccountController
 * @description: 用户账户页面控制器
 * @author: Jackeys
 * @date: 2021-01-31 00:34
 */
@RestController
@RequestMapping("/AccountController")
@CrossOrigin
public class AccountController {
    @Autowired
    private UserService userService;

    @PostMapping(value = "/addAccount")
    /**
     * @description 处理用户账户充值
     * @Param: account
     * @Param: id
     * @return ResponseData
     * @author Jackeys
     * @date 2021-01-31 00:36
     */
    public ResponseData addAccount(int account,int id){
        return userService.addAccount(account,id);
    }

    @PostMapping(value = "/getUser")
    /**
     * @description 返回用户信息
     * @Param: email
     * @Param: password
     * @return ResponseData
     * @author Jackeys
     * @date 2021-01-31 01:07
     */
    public ResponseData getUser(String email,String password){
        return userService.getUser(email,password);
    }
}
